<%-- 
    Document   : index
    Created on : 12/05/2011, 07:05:24 AM
    Author     : George
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>calculadora</h1>
        <script>
           
function calcula(operacion){
    var operando1 = document.calc.N1.value
    var operando2 = document.calc.value
    var result = eval(operando1 + operacion + operando2)
    document.calc.resultado.value = result
}
</script> 

</script> 
    </body>
    <form
        <table>
            <tr>
                <td>
                    <input type="button" name="N1" value="1" size="12" onclick="var operando1 = 1">
                    <input type="button" name="N2" value="2" size="12" onclick="var operando1 = 2">
   <input type="button" name="N3" value="3" size="12" onclick="var operando1 = 3">
   <input type="button" name="N4" value="4" size="12" onclick="var operando1 = 4">
   <input type="button" name="N5" value="5" size="12" onclick="var operando1 = 5">
    <br>
        <input type="button" name="N6" value="6" size="12" onclick="var operando1 = 6">
    <input type="button" name="N7" value="7" size="12" onclick="var operando1 = 7">
    <input type="button" name="N8" value="8" size="12" onclick="var operando1 = 8">
    <input type="button" name="N9" value="9" size="12" onclick="var operando1 = 9">
    <input type="button" name="N0" value="0" size="12" onclick="var operando1 = 0">
<br>
<input type="Button" name="" value=" + " onclick="calcula('+')">
<input type="Button" name="" value=" - " onclick="calcula('-')">
<input type="Button" name="" value=" * " onclick="calcula('*')">
<input type="Button" name="" value=" / " onclick="calcula('/')">
<br>
<input type="Text" name=" get " value="0" size="12">

           

            <input type="submit"/>
        </table>
   </form>
</html>
